home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer (Italian) 30
/
PC Gamer IT CD 30 1-2.iso
/
MOTS
/
GAMEDATA
/
RESOURCE
/
JKMRES.GOO
/
cog_item_shields_m.cog
< prev
next >
Wrap
Text File
|
1998-02-25
|
3KB
|
150 lines
# Jedi Knight Missions Cog Script
#
# ITEM_SHIELDS_M.COG
#
# ITEM Script - Shields
# Bin 60
#
# [YB]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
symbols
thing player
flex shields
flex shieldsLeft
flex damage
flex halfdamage
flex type
sound hitsnd=KShieldHit01.wav
message damaged
end
# ========================================================================================
code
damaged:
player = GetSenderRef();
shields = GetInv(player, 60);
damage = GetParam(0);
halfdamage = 0;
if(shields > 0)
{
type = GetParam(1);
shieldsLeft = shields;
// If damage from energy or fire.
if((type == 2) || (type == 4))
halfdamage = damage;
else
if(type == 16)
halfdamage = damage / 2;
if ((halfdamage > 0.0) && shieldsLeft)
{
AddDynamicTint(player, 0, damage/50, 0);
PlaySoundThing(hitsnd, player, 1.0, -1, -1, 128);
if (shields > 50)
{
shieldsLeft = shields - 50;
if (shieldsLeft > halfdamage)
shieldsLeft = halfDamage;
damage = damage - shieldsLeft;
halfdamage = halfDamage - shieldsLeft;
shields = shields - shieldsLeft;
}
if (halfDamage > 0.0)
{
halfDamage = halfDamage / 2;
shieldsLeft = shields;
if (shieldsLeft > halfdamage)
shieldsLeft = halfDamage;
damage = damage - shieldsLeft;
halfdamage = halfDamage - shieldsLeft;
shields = shields - shieldsLeft;
}
}
// if((type == 2) || (type == 4))
// {
// AddDynamicTint(player, 0, damage/50, 0);
// PlaySoundThing(hitsnd, player, 1.0, -1, -1, 128);
//
// // Shields do full protection until they are at 50 or less.
// shieldsLeft = shields - damage;
// if(shieldsLeft > 50)
// {
// damage = 0;
// }
// else
// if(shields > 50)
// {
// damage = damage - (shields - 50);
// }
//
// // Scale what damage is left by shields.
// if(damage > 0)
// {
// damage = damage * (1 - shieldsLeft / 50);
// }
// Inventory system will minimize shields at 0.
SetInv(player, 60, shields);
// }
//
// // If damage from saber.
// if(type == 16)
// {
// AddDynamicTint(player, 0, damage/50, 0);
// PlaySoundThing(hitsnd, player, 1.0, -1, -1, 0);
//
// // Shields do half protection
// halfdamage = damage / 2;
// damage = halfdamage;
//
// shieldsLeft = shields - damage;
// if(shieldsLeft > 50)
// {
// damage = 0;
// }
// else
// if(shields > 50)
// {
// damage = damage - (shields - 50);
// }
//
// // Scale what damage is left by shields.
// if(damage > 0)
// {
// damage = damage * (1 - shieldsLeft / 50);
// }
//
// // Inventory system will minimize shields at 0.
// SetInv(player, 60, shieldsLeft);
//
// // add the original half damage back
// damage = damage + halfdamage;
// }
}
ReturnEx(damage);
Return;
end